<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>  

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	
	<div id="menu_tab">
      <div class="left_menu_corner"></div>
      <ul class="menu">
        <li><a href="<%= request.getContextPath()%>/index.jsp" class="nav1"> Home</a></li>
        <li class="divider"></li>
        <li><a href="<%= request.getContextPath()%>/product/searchProduct" class="nav2">Products</a></li>
        <li class="divider"></li>
        <li><a href="http://all-free-download.com/free-website-templates/" class="nav3">Specials</a></li>
        <li class="divider"></li>
        
       <!--  <li><a href="http://all-free-download.com/free-website-templates/" class="nav5">Shipping</a></li> -->
        
        <li><a href="<%= request.getContextPath()%>/test/uploadFile.jsp" class="nav5">Test</a></li>
        
        
        <li class="divider"></li>
        <li><a href="contact.html" class="nav6">Contact Us</a></li>
        <li class="divider"></li>
        
        <li><a href="<%= request.getContextPath()%>/user/userDetail" class="nav4">My account</a></li>
        <li class="divider"></li>
        
        <%
        	//validate cookie
        	Cookie[] cookies = request.getCookies();
        	if(cookies != null){
        		for(Cookie cookie : cookies){
 //           		System.out.println(cookie.getName() + " : " + cookie.getValue());
            	}
        	}
        
        	//validate session
        	String username = (String) session.getAttribute("username");
        	if(username == null){
        %>
        	<li><a href="<%= request.getContextPath()%>/user/login.jsp" class="nav4">Log in</a></li>
        <%
        	}else{
        %>
        	<li>
        		<a href="<%= request.getContextPath()%>/logout" class="nav4">Log out</a>
        	</li>
        	<li>
        		<span style="font-size: 13px; padding-left: 10px;">Hello <%= username%></span>
        	</li>
        <%
        	}
        %>
        
        
        <li class="divider"></li>
        
        <!-- <li class="currencies">Currencies
          <select>
            <option>US Dollar</option>
            <option>Euro</option>
          </select>
        </li> -->
      </ul>
      <div class="right_menu_corner"></div>
    </div>
	
</body>
</html>